package com.example.baselibrary.base

import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.example.baselibrary.utils.ActivityCollector


abstract class BaseActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(initLayout())
        initPrepar();
        initView();
        initData();
    }

    private fun initPrepar() {
        Log.d("BaseActivity",javaClass.simpleName)
        ActivityCollector.addActivity(this)

    }

    abstract fun initLayout(): Int;

    abstract fun initView()

    abstract fun initData()

    override fun onDestroy() {
        super.onDestroy()
        ActivityCollector.removeActivity(this)
    }
}